package history.study.tow_pointer;

public class LeetCode_136 {
    /**
     *  异或：满足交换律  A^B^C = A^C^B
     *        两个相同的数异或等于0，任何数与0异或等于本身
     */
    public int singleNumber(int[] nums) {
        if (nums == null || nums.length<=0) return 0;
        int result = 0;
        for (int num : nums) {
            result ^= num;
        }
        return result;
    }
}
